package com.huasan.www.demon.data;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class TimingServiceListener implements ServletContextListener {

	TimingService service;
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		if (service!=null)
			service.stop();
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		Runnable service = new TimingService();
		Thread thread = new Thread(service);
		thread.start();
	}
	
}
